package tp.pr5.mv.instructions.arithmetic;

import tp.pr5.mv.Opcode;
import tp.pr5.mv.instructions.BinaryInstructions;
import tp.pr5.mv.traps.Division0Ex;
import tp.pr5.mv.traps.MVTrap;

public class DIV extends BinaryInstructions {
	
    public DIV() {
		
		op = Opcode.DIV;
	}
    
	
	public int combine ( int op1, int op2 ) throws MVTrap {
		
		if ( op1 == 0 )
			throw new Division0Ex();    // Si se va a dar División por 0, lanzamos la excepción.
		
		return op2 / op1;     // División de operandos.
	}

}
